﻿//////////////////////////////////////////////////////////////////////////////
//
//  Copyright © 1998-2024 Glodon Company Limited.  All rights reserved.
//
//  Use of this software is subject to the terms of the Glodon license
//  agreement provided at the time of installation or download, or which
//  otherwise accompanies this software in either electronic or hard copy form.  
//
//////////////////////////////////////////////////////////////////////////////

// Reviewed
#pragma once
#include "GcmpModelInterface.h"
#include "IDbObject.h"
#include "GbmpQuickCast.h"
#include "ParameterStorageType.h"

namespace gcmp
{
    class IParameterValidator;

    /// \brief 参数值存储基类
    class GCMP_MODEL_INTERFACE_EXPORT IParameterValueStorage : public IDbObject
    {
    public:
        DEFINE_CAST_DERIVED(gcmp::IParameterValueStorage, gcmp::IDbObject)
    public:
        /// \brief 克隆参数值存储对象
        ///
        /// \return 参数值存储对象
        virtual OwnerPtr<IParameterValueStorage> Clone() const = 0; 

        /// \brief 判断当前参数值与给定的参数值是否相等
        ///
        /// \param pOther 另一参数值存储对象指针
        /// \return 两者相同返回true，否则返回false
        virtual bool HasSameValue(const IParameterValueStorage* pOther) const = 0;

        /// \brief 判断当前参数值小于给定的参数值
        ///
        /// \param pOther 另一参数值存储对象指针
        /// \return 当前参数值小于给定的参数值返回true，否则返回false
        virtual bool IsLessThan(const IParameterValueStorage* pOther) const = 0;

        /// \brief 设置当前参数验证器
        /// 
        /// 若已存在参数验证器，则覆盖
        /// 
        /// \param pParameterValidator 参数验证器
        /// \return true 设置成功， false 设置失败
        virtual bool SetValidator(OwnerPtr<IParameterValidator> pParameterValidator) = 0;

        /// \brief 获取当前参数的验证器
        ///
        /// \return IParameterValidator* 当前参数的验证器，若当前参数没有验证器，则返回为nullptr
        virtual const IParameterValidator* GetValidator() const = 0;

        /// \brief 获取当前参数的存储类型
        ///
        /// \return ParameterStorageType 存储类型
        virtual ParameterStorageType GetParameterStorageType() const = 0;
    };
}



